<%@page import="java.text.SimpleDateFormat" %>
<%@ page language="java" import="java.util.Date" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="cache-control" content="no-cache"/>
    <meta http-equiv="expires" content="0"/>
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
    <meta http-equiv="description" content="This is my page"/>

    <link href="${pageContext.request.contextPath}/static/css/front.css" rel="stylesheet" type="text/css"
          media="screen"/>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/jquery/ui.datepicker.css" type="text/css"
          media="screen" charset="utf-8"/>

    <script src="${pageContext.request.contextPath}/static/jquery/jquery-1.2.6.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/static/jquery/ui.datepicker.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/static/jquery/ui.datepicker-zh-CN.js" type="text/javascript"
            charset="utf-8"></script>
    <link href="${pageContext.request.contextPath}/static/css/daoke.css.css" rel="stylesheet" type="text/css"
          media="screen"/>
    <script type="text/javascript">
        jQuery(function ($) {
            $('#datepicker').datepicker({
                yearRange: '1900:2099', //取值范围.
                showOn: 'both', //输入框和图片按钮都可以使用日历控件。
                buttonImage: '${pageContext.request.contextPath}/static/jquery/calendar.gif', //日历控件的按钮
                buttonImageOnly: true,
                showButtonPanel: true
            });

        });

        function cx() {

            if (document.form2.createTime.value == "") {
                alert("请输入挂号日期");
                return false;
            }
            var today = "<%=new SimpleDateFormat("yyyy-MM-dd").format(new Date())%>";
            var createTime = document.form2.createTime.value;

            if (Date.parse(today.replace("-", "/")) >= Date.parse(createTime.replace("-", "/"))) {
                alert("挂号日期只能是今日以后的日期");
                return false;
            }
            var s = DateDiff(today, createTime)
            if (s > 7) {
                alert("只能挂号未来7天的日期");
                return false;
            }
            if (document.form2.disease.value == "") {
                alert("请输入所患疾病");
                return false;
            }
            if (document.form2.name.value == "") {
                alert("请输入你的姓名");
                return false;
            }
            document.form2.submit();
        }


        function DateDiff(sDate1, sDate2) {
            var aDate, oDate1, oDate2, iDays
            aDate = sDate1.split("-");
            oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);  //转换为mm-dd-yyyy格式
            aDate = sDate2.split("-");
            oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);
            iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24);  //把相差的毫秒数转换为天数
            //alert(iDays);
            return iDays;
        }
    </script>
</head>

<body style="background: -webkit-linear-gradient(#A5DBFE,#FFFFFF)">
<jsp:include flush="true" page="/front/inc/top.jsp"></jsp:include>

<div class="w1440 bg-f" style="margin: 0 auto;min-height: 700px;">
    <div id="page-bgtop">
        <div id="page-bgbtm">
            <div id="content">
                <div class="post">
                    <h1 class="title"><a href="#">在线挂号</a></h1>
                    <div class="entry">
                        <form action="${pageContext.request.contextPath}/register/addRegister.html" name="form2"
                              method="post">
                            <table align="left" border="0" cellpadding="9" cellspacing="9" width="1020px;">
                                <tr align='center'>
                                    <td style="width: 100px;font-size: 18px;" align="left">
                                        挂号日期：
                                    </td>
                                    <td align="left" >
                                        <input name="createTime" type="date" style="width: 200px;height: 30px;"/>
                                    </td>
                                </tr>
                                <tr align='center'>
                                    <td style="width: 100px;font-size: 18px;" align="left">
                                        挂号日期：
                                    </td>
                                    <td align="left">
                                        <select name="time" id="time" style="width: 200px;" class="select">
                                            <option value="8：00-9：00">8：00-9：00</option>
                                            <option value="9：00-10：00">9：00-10：00</option>
                                            <option value="10：00-11：00">10：00-11：00</option>
                                            <option value="11：00-12：00">11：00-12：00</option>
                                            <option value="14：00-15：00">14：00-15：00</option>
                                            <option value="15：00-16：00">15：00-16：00</option>
                                            <option value="16：00-17：00">16：00-17：00</option>
                                            <option value="17：00-18：00">17：00-18：00</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr align='center'>
                                    <td style="width: 100px;font-size: 18px;" align="left">
                                        所患疾病：
                                    </td>
                                    <td align="left">
                                        <input name="disease" type="text" style="width: 200px;"/>
                                    </td>
                                </tr>
                                <tr align='center'>
                                    <td style="width: 100px;font-size: 18px;" align="left">
                                        你的姓名：
                                    </td>
                                    <td align="left">
                                        <input name="name" type="text" style="width: 200px;"/>

                                    </td>
                                </tr>
                                <tr align='center'>
                                    <td style="width: 100px;font-size: 18px;" align="left">
                                        联系方式：
                                    </td>
                                    <td align="left">
                                        <input name="tel" type="text" style="width: 200px;"/>

                                    </td>
                                </tr>
                                <tr align='center'>
                                    <td style="width: 60px;" align="left"></td>
                                    <td align="left">
                                        <input type="hidden" name="expertId"
                                               value="<%=request.getParameter("expertId") %>">
                                        <input type="button" value="确定" onclick="cx()" style="border:#ccc 1px solid; background-color:#6699cc; font-size:12px; padding-top:3px;width: 90px;" class="btn"/>&nbsp;
                                        <input type="reset" value="重置" style="border:#ccc 1px solid; background-color:#6699cc; font-size:12px; padding-top:3px;width: 90px;" class="btn"/>&nbsp;
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
                <div style="clear: both;">&nbsp;</div>
            </div>
            <jsp:include flush="true" page="/front/inc/right.jsp"></jsp:include>
            <div style="clear: both;">&nbsp;</div>
        </div>
    </div>
</div>


<div style="margin: 0 auto;height: 140px;background: #545454;color:#bbbbbb;margin-top: 20px;text-align: center;" class="w1440 font14 text-c">
    <div class="ht30 l-ht30" style="font-size: 18px;line-height: 80px;">Copyright (c) 2019 Sitename.com. All rights reserved.</div>
    <div class="ht30 l-ht30" style="font-size: 18px;line-height: 80px;"><a
            href="${pageContext.request.contextPath}/login.jsp" style="color: #ffffff">管理员或医生登陆</a></div>

</div>
</body>
</html>
